<%--                                                                       --%>
<%-- Copyright (c) 2004 BroadVision, Inc.  All rights reserved.            --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>

<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean-el" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>

<script language="javascript">

<%@ include file="/mc/common/jsutils.jsp" %>
  //
  function closeWindow() {
    self.close();
  }
  
  function doOneBlockDeleteAction(blockId, pageTypeId) {
    if(confirm('<bean-el:message key="ep.block.confirm.delete" bundle="ep.messages"/>')){
      document.epPageTypeSearchReportForm.blockId.value = blockId;
      document.epPageTypeSearchReportForm.pageTypeId.value = pageTypeId;
      document.epPageTypeSearchReportForm.action = '<c:url value="/ep/allInfoForPageTypeReportDelete.do"/>';
      document.epPageTypeSearchReportForm.submit();
      return;
    }
    return false;
  }

  function doBlockDeleteAction(pageTypeId) {
    if(confirm('<bean-el:message key="ep.blocks.confirm.delete" bundle="ep.messages"/>')){
      document.epPageTypeSearchReportForm.blockId.value = 0;
      document.epPageTypeSearchReportForm.pageTypeId.value = pageTypeId;
      document.epPageTypeSearchReportForm.action = '<c:url value="/ep/allInfoForPageTypeReportDelete.do"/>';
      document.epPageTypeSearchReportForm.submit();
      return;
    }
    return false;
  }

</script>

<% String ctxPath = request.getContextPath(); %>
<c:set var="editImg">
<img src="<%= ctxPath %>/ep/images/action/icon_edit.gif" width="15" height="15" border="0" class="actionIcon" alt="<bean-el:message key="image.alt.edit" bundle="ep.messages"/>" title="<bean-el:message key="image.alt.edit" bundle="ep.messages"/>">
</c:set>
<c:set var="deleteImg">
<img src="<%= ctxPath %>/ep/images/action/icon_delete.gif" width="15" height="15" border="0" class="actionIcon" alt="<bean-el:message key="image.alt.delete" bundle="ep.messages"/>" title="<bean-el:message key="image.alt.delete" bundle="ep.messages"/>">
</c:set>

<html-el:form action="/ep/allInfoForPageTypeReportList.do">
<input type="hidden" name="pageTypeId" value="<c:out value='${epAllInfoForPageTypeReportView.map.id}'/>"/>
<input type="hidden" name="blockId"/>
<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
  <tr>
    <td valign="top" width="100%">
    
      <div class="generalWrapRight">
        <html-el:button property="closeWinBtn" styleClass="inputButton" onclick="javascript:closeWindow()">
          <bean-el:message key="button.close"  bundle="ep.messages"/>
        </html-el:button>
      </div> 
      
      <div class="pageTitle">
        <bean-el:message key="ep.report.title" bundle="ep.messages"/>: <bean-el:message key="ep.report.list.block.pageType" bundle="ep.messages"/>
      </div>
      <div class="errorMessage"><html-el:errors bundle="ep.messages"/></div>
	  
      <div class="pageSubtitle">
        <span class="left"><bean-el:message key="ep.page.type.information" bundle="ep.messages"/></span>
      </div>
      <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
        <tr> 
          <td class="label" width="20%">
            <bean-el:message key="ep.page.type.name" bundle="ep.messages"/>:
          </td>
          <td class="labelField" width="80%">
            <c:out value="${epAllInfoForPageTypeReportView.map.name}"/>
          </td>
        </tr>
        <tr> 
          <td class="label" width="20%">
            <bean-el:message key="ep.page.type.display.name" bundle="ep.messages"/>:
          </td>
          <td class="labelField" width="80%">
            <c:out value="${epAllInfoForPageTypeReportView.map.defaultTabName}"/>
          </td>
        </tr>
        <tr> 
          <td class="label" width="20%">
            <bean-el:message key="ep.page.type.display.template" bundle="ep.messages"/>:
          </td>
          <td class="labelField" width="80%">
            <c:out value="${epAllInfoForPageTypeReportView.map.displayTemplateName}"/>
          </td>
        </tr>
        <tr> 
          <td class="label" width="20%">
            <bean-el:message key="ep.page.type.required.blocks.entries" bundle="ep.messages"/>:
          </td>
          <td class="labelField" width="80%">
            <c:out value="${epAllInfoForPageTypeReportView.map.numberOfEntries}"/>
          </td>
        </tr>
      </table>
	
      <c:if test="${not empty epAllInfoForPageTypeReportView.map.blockList}">
        <div class="globalButtonWrap">
          <input type="button" name="actionSelectAll" class="globalButton" 
            onClick="check(this.form.blockIds, this);"
            value="<bean-el:message key="button.selectAll" bundle="ep.messages"/>">
          <input type="button" name="actionDelete" class="globalButton" 
            onClick="if (isAnyChecked(this.form.blockIds, '<bean-el:message key="ep.blocks.alert.atLeastOne" bundle="ep.messages"/>', '')) doBlockDeleteAction('<c:out value="${epAllInfoForPageTypeReportView.map.id}"/>');" 
            value="<bean-el:message key="button.delete" bundle="ep.messages"/>">
        </div>
      </c:if>
	
      <table class="dataTable" border="0" cellspacing="1" cellpadding="2" summary="Search result table" width="100%">
        <tr class="listHeader">
          <th id="Checkboxes">&nbsp;</th>
          <th id="Name" align="left">
            <bean-el:message key="ep.report.block.list.header.name" bundle="ep.messages"/>
          </th>
          <th id="Type" align="left">
            <bean-el:message key="ep.report.block.list.header.type" bundle="ep.messages"/>
          </th>
          <th id="Programs" align="left">
            <bean-el:message key="ep.report.block.list.header.program" bundle="ep.messages"/>
          </th>
          <th id="Actions" align="left" nowrap>
            <bean-el:message key="ep.report.block.list.header.actions" bundle="ep.messages"/>
          </th>
        </tr>
        <c:choose>
          <c:when test="${not empty epAllInfoForPageTypeReportView.map.blockList}">
            <c:forEach var="item" items="${epAllInfoForPageTypeReportView.map.blockList}" varStatus="status">
              <c:choose>
                <c:when test="${(status.count + 1) % 2 == 0}">
                  <tr class="listEven">
                </c:when> 
                <c:otherwise>
                  <tr class="listOdd">
                </c:otherwise>
              </c:choose>
              <td headers="Checkboxes" align="center">
                <bean:define id="thisId" name="item" property="id"/>
                <input type="checkbox" name="blockIds"
                  onClick="update(this.form.blockIds, this.form.actionSelectAll);"
                  value="<bean:write name='thisId'/>"/>
              </td>
              <c:url var="viewUrl" value="/ep/blockView.do">
                <c:param name="blockId" value="${item.map.id}"/>
                <c:param name="pageTypeId" value="${epAllInfoForPageTypeReportView.map.id}"/>
              </c:url>
              <td headers="Name">
                <a href='<c:out value="${viewUrl}"/>' target='window<%=request.getSession().getId()%>'>
                  <c:out value="${item.map.name}"/></a>
              </td>
              <td headers="Type">
                <c:if test="${item.map.isNavigationBlock == true}">
                  <bean-el:message key="ep.block.type.navigation" bundle="ep.messages"/>
                </c:if>
                <c:if test="${item.map.isSearchBlock == true}">
                  <bean-el:message key="ep.block.type.search" bundle="ep.messages"/>
                </c:if>
                <c:if test="${item.map.isNavigationBlock == false && item.map.isSearchBlock == false}">
                  <c:if test="${item.map.blockType == 0}">
                    <bean-el:message key="ep.block.type.optional" bundle="ep.messages"/>
                  </c:if>
                  <c:if test="${item.map.blockType == 1}">
                    <bean-el:message key="ep.block.type.default" bundle="ep.messages"/>
                  </c:if>
                  <c:if test="${item.map.blockType == 2}">
                    <bean-el:message key="ep.block.type.required" bundle="ep.messages"/>
                  </c:if>
                </c:if>
              </td>
              <td headers="Programs">
                <c:forEach var="pRow" items="${item.map.programs}">
                  <c:out value="${pRow}"/><br/>
                </c:forEach>
              </td>
              <c:url var="editUrl" value="/ep/blockEdit.do">
                <c:param name="blockId" value="${item.map.id}"/>
                <c:param name="pageTypeId" value="${epAllInfoForPageTypeReportView.map.id}"/>
              </c:url>
                  <td headers="Actions">
                    <a href='<c:out value="${editUrl}"/>' target='window<%=request.getSession().getId()%>'>
                      <c:out value='${editImg}' escapeXml="false"/></a>
                    <a href='#' onclick="doOneBlockDeleteAction('<c:out value="${item.map.id}"/>', 
                    '<c:out value="${epAllInfoForPageTypeReportView.map.id}"/>');">
                      <c:out value='${deleteImg}' escapeXml="false"/></a>
                  </td>
                </tr>
            </c:forEach>
          </c:when>
          <c:otherwise>
            <tr class="listOdd">
              <td align="center" colspan="5">
                <bean-el:message key="ep.blocks.noFound" bundle="ep.messages"/>
              </td>
            </tr>
          </c:otherwise>
        </c:choose>
      </table>

    </td>
  </tr>
</table>
</html-el:form>
